#include "dominion.h"
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
int testConsoleRoom()
{
	printf("Testing Council Room.\n");

	// Initializations
	struct gameState *G = newGame();
	struct gameState *G2 = (struct gameState*)malloc(sizeof(struct gameState));
	srand(time(NULL));
	int r = rand();

	int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, sea_hag, tribute, smithy};
	initializeGame(2, k, r, G);
	G->hand[0][0] = council_room;
	G->whoseTurn = 0;
	G->phase = 0;
	G->numActions = 1;

	//Copy the game state prior to calling playCard
	memcpy(G2, G, sizeof(struct gameState));

	printf("Test to make sure playCard does not err.\n");
	assert(playCard(0, 0, 0, 0, G) == 0);
	printf("Test Passed\n.");

	printf("Test if we have 3 more cards in hand.\n");
	assert(G2->handCount[0] == G->handCount[0] - 3);
	printf("Test Passed.\n");

	printf("Test if we have 1 more buy.\n");
	assert(G2->numBuys == G->numBuys - 1);
	printf("Test Passed.\n");

	printf("Test if we have 1 less action.\n");
	assert(G2->numActions == G->numActions + 1);
	printf("Test Passed.\n");

	printf("Test if all other players have drawn a card.\n");
	assert(G2->handCount[1] == G->handCount[1] - 1);
	printf("Test Passed.\n");

	printf("All tests passed.\n");
	
	return 0;
}

int main()
{
	return testConsoleRoom();
}
